package com.example.demo.controller;

import com.example.demo.common.entity.MsgInfo;
import com.example.demo.entity.DTO.LoginUserInDto;
import com.example.demo.entity.websocket.User;
import com.example.demo.service.UserNewService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserNewController {
    @Resource
    private UserNewService userNewService;
    @PostMapping("login")
    public MsgInfo login(@RequestBody LoginUserInDto inDto){
        User user = userNewService.login(inDto);
        return MsgInfo.ok(user);
    }
}
